Skip to content

Add multi-VM runbook and fixed Raft bootstrap members#326

Open
bootjp wants to merge 12 commits intomainfrom
feature/prd-workload
Open

Add multi-VM runbook and fixed Raft bootstrap members#326
bootjp wants to merge 12 commits intomainfrom
feature/prd-workload

Conversation

@bootjp
Copy link
Owner

@bootjp bootjp commented Feb 27, 2026

Summary

  • add an English multi-VM Docker run deployment guide for 4-5 node clusters (no Docker Compose)
  • add fixed bootstrap member configuration via --raftBootstrapMembers for deterministic initial cluster formation
  • improve AddVoter/bootstrap test coverage and harden demo/test startup paths
  • strengthen security guidance for unauthenticated endpoints and network isolation

Validation

  • go test ./...
  • golangci-lint --config=.golangci.yaml run --fix

Copilot AI review requested due to automatic review settings February 27, 2026 03:46
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the project's operational readiness and robustness. It introduces detailed documentation for deploying a multi-node Elastickv cluster using Docker, providing clear instructions for manual setup on multiple virtual machines. Concurrently, it improves the reliability of the system through expanded test coverage, including a new test for Raft's dynamic cluster membership changes and a refactoring of DynamoDB compatibility tests. Additionally, the PR refines the Raft bootstrap mechanism by allowing explicit definition of initial cluster members and addresses a minor bug in DynamoDB JSON attribute unmarshalling.

Highlights

  • Deployment Documentation: A new comprehensive guide has been added for manually deploying a multi-node Elastickv cluster using Docker across multiple VMs, providing clear instructions for setup.
  • Raft Bootstrap Enhancement: A new --raftBootstrapMembers flag was introduced, allowing users to specify a fixed list of Raft cluster members during bootstrap, which improves control over initial cluster formation.
  • Improved Test Coverage: Test coverage has been expanded with a new integration test for the Raft AddVoter functionality and existing DynamoDB API compatibility tests were refactored into more granular sub-tests for better organization.
  • DynamoDB JSON Unmarshalling Fix: A bug in the attributeValue JSON unmarshalling logic within the DynamoDB adapter has been corrected to properly handle single-key maps.
  • Code Refactoring: Server startup and Raft cluster joining logic have been refactored for improved modularity, readability, and error handling.
Changelog
  • README.md
    • Updated to include a link to the new deployment documentation.
  • adapter/add_voter_join_test.go
    • Added a new test case to verify that a new voter can successfully join the Raft cluster and serve traffic.
  • adapter/dynamodb.go
    • Added comments to clarify the purpose of StartTS in buildTransactWriteItemsRequest for transaction alignment.
  • adapter/dynamodb_table_compat_test.go
    • Refactored the DynamoDB table API compatibility tests into distinct sub-tests and introduced helper functions for better organization and readability.
  • adapter/dynamodb_types.go
    • Corrected the JSON unmarshalling logic for attributeValue to properly handle single-key maps.
  • cmd/server/demo.go
    • Refactored the joinCluster function by extracting retry logic and AddVoter await into dedicated helper functions (joinNodeWithRetry, tryJoinNode).
  • docs/docker_multinode_manual_run.md
    • Added a new document detailing the manual setup of a 4-5 node Elastickv cluster on multiple VMs using docker run.
  • main.go
    • Introduced a new command-line flag --raftBootstrapMembers.
    • Updated buildShardGroups to accept bootstrap servers.
    • Refactored the main server startup logic into a new startRuntimeServers function.
  • main_bootstrap_test.go
    • Added new unit tests for the resolveBootstrapServers function, covering various scenarios for bootstrap member resolution.
  • multiraft_runtime.go
    • Modified newRaftGroup to accept an optional list of bootstrapServers for initial Raft cluster configuration.
  • multiraft_runtime_test.go
    • Updated the TestNewRaftGroupBootstrap function to reflect changes in newRaftGroup signature.
  • shard_config.go
    • Defined a new error type ErrInvalidRaftBootstrapMembersEntry.
    • Implemented the parseRaftBootstrapMembers function to parse the new bootstrap members flag.
  • shard_config_test.go
    • Added new unit tests for the parseRaftBootstrapMembers function, including tests for valid parsing, whitespace trimming, and error conditions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a valuable feature for bootstrapping a multi-node cluster from a static configuration, complete with documentation and tests. It also improves test coverage by adding a new integration test for AddVoter and refactoring a large test for better readability. The changes are generally solid. I have a couple of suggestions to improve test robustness and address the use of a deprecated function.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for bootstrapping a Raft cluster with an explicit member list, expands/organizes test coverage around bootstrapping and join behavior, and adds a multi-node Docker deployment runbook.

Changes:

  • Add --raftBootstrapMembers support (parsing + validation) and plumb explicit bootstrap server configuration into Raft startup.
  • Refactor startup code to use a startRuntimeServers helper and improve demo cluster join logic to await AddVoter.
  • Add/reshape tests for bootstrap parsing/validation and Raft join path; add deployment documentation.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
shard_config.go Adds parseRaftBootstrapMembers + new error for invalid entries.
shard_config_test.go Adds unit tests for parsing bootstrap member strings.
main.go Adds --raftBootstrapMembers, validates/derives bootstrap server list, plumbs into runtime startup; introduces startRuntimeServers.
main_bootstrap_test.go Adds tests for bootstrap server resolution/validation behavior.
multiraft_runtime.go Extends newRaftGroup to accept explicit bootstrap server config.
multiraft_runtime_test.go Updates newRaftGroup call site for new signature.
cmd/server/demo.go Refactors join logic into helpers and awaits AddVoter completion.
adapter/add_voter_join_test.go Adds an integration-style test covering AddVoter join + serving adapter traffic.
adapter/dynamodb_types.go Refactors AttributeValue JSON unmarshal path.
adapter/dynamodb_table_compat_test.go Refactors large compatibility test into subtests + helper closures.
adapter/dynamodb.go Adds clarification comment on transaction StartTS alignment with condition evaluation snapshot.
docs/docker_multinode_manual_run.md Adds multi-VM manual docker run runbook for 4–5 node clusters.
README.md Links the new deployment/runbook document.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bootjp bootjp requested a review from Copilot March 1, 2026 16:20
@bootjp
Copy link
Owner Author

bootjp commented Mar 1, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant feature for cluster bootstrapping using a fixed list of members via the --raftBootstrapMembers flag, which is very useful for environments without dynamic service discovery. The implementation is well-supported with new documentation, unit tests, and an end-to-end test.

Additionally, the PR improves test coverage with a new integration test for the AddVoter join path and refactors an existing large test for better maintainability. The demo server's cluster joining logic has also been made more robust.

My review found one medium-severity issue in the new add_voter_join_test.go test regarding error handling in goroutines, which could lead to flaky test results. Overall, this is a high-quality contribution that enhances the project's deployment flexibility and test robustness.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bootjp bootjp requested a review from Copilot March 2, 2026 20:04
@bootjp
Copy link
Owner Author

bootjp commented Mar 2, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant improvement for cluster deployment by adding a --raftBootstrapMembers flag, allowing for static cluster bootstrapping. This is well-documented in the new docker_multinode_manual_run.md guide. The test coverage is also enhanced with new end-to-end and unit tests for this feature, and existing tests have been refactored for better clarity. The demo cluster join logic has also been made more robust. My review found a few places in new test files where the deprecated grpc.NewClient function is used; I've suggested replacing it with grpc.Dial for better future maintainability. None of the provided rules were applicable to modify or drop these comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bootjp
Copy link
Owner Author

bootjp commented Mar 2, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant improvement for cluster bootstrapping by adding the --raftBootstrapMembers flag, allowing for a declarative, fixed-member startup. This is a more robust alternative to dynamic joins for initial cluster formation. The implementation is well-tested with new unit and end-to-end tests. Additionally, the PR improves existing test coverage by refactoring a large test into more manageable sub-tests and enhances the demo server's join logic to be more reliable. The new deployment documentation is clear and helpful. Overall, this is a high-quality contribution that improves both functionality and maintainability.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bootjp bootjp requested a review from Copilot March 3, 2026 13:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bootjp bootjp requested a review from Copilot March 3, 2026 14:04
@bootjp
Copy link
Owner Author

bootjp commented Mar 3, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly improves cluster deployment by adding the --raftBootstrapMembers flag for a fixed-member bootstrap process, along with enhanced documentation, end-to-end tests, improved test coverage for the AddVoter join path, and a refactored test for readability, alongside a correction for a bug in the demo cluster's join logic. However, a high-severity expression injection vulnerability was identified in the DynamoDB adapter's expression handling logic. This vulnerability directly undermines the security and integrity of condition checks and update operations, and strict validation for expression attribute names is recommended to prevent logic bypass and unauthorized data modification. Additionally, the retry logic for joining nodes could be simplified for better clarity.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bootjp bootjp changed the title Add deployment docs and improve test coverage Add multi-VM runbook and fixed Raft bootstrap members Mar 3, 2026
@bootjp bootjp requested a review from Copilot March 3, 2026 14:17
@bootjp
Copy link
Owner Author

bootjp commented Mar 3, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This is an excellent pull request that introduces a significant feature for deterministic cluster bootstrapping using --raftBootstrapMembers. The accompanying documentation is clear, comprehensive, and provides strong security guidance. The new tests, including the end-to-end tests for the bootstrap mechanism and the AddVoter path, are thorough and greatly improve confidence in the system's robustness. The security hardening to prevent expression injection in the DynamoDB adapter is a crucial improvement. The refactoring of the demo startup logic and tests for better readability is also a welcome change. I have one minor suggestion to improve maintainability by reducing the number of parameters in a helper function.

@bootjp
Copy link
Owner Author

bootjp commented Mar 3, 2026

/gemini review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several valuable improvements, including a new runbook for multi-VM deployments and a fixed bootstrap member configuration for deterministic cluster setup. The security hardening for DynamoDB expression attributes is a crucial addition, and the test coverage has been significantly enhanced with new end-to-end and unit tests. The refactoring of the cluster join logic and server startup code also improves robustness and maintainability. I've found one issue with the new DynamoDB attribute name validation being too restrictive, which I've commented on. Overall, this is a great set of changes.

@bootjp
Copy link
Owner Author

bootjp commented Mar 3, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a critical security hardening for the DynamoDB adapter by adding validation to prevent expression injection attacks. The changes are well-implemented and include thorough tests. Additionally, the PR improves the robustness of the demo cluster startup, refactors a large test for better maintainability, and adds a new comprehensive test for the AddVoter join path. However, the new feature for static cluster bootstrapping via --raftBootstrapMembers appears to have several issues in its implementation, testing, and documentation, which will prevent it from working as intended. I've left detailed comments on these specific issues.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bootjp bootjp requested a review from Copilot March 3, 2026 14:50
@bootjp
Copy link
Owner Author

bootjp commented Mar 3, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant improvement to cluster bootstrapping by adding a --raftBootstrapMembers flag for deterministic initial cluster formation, which is valuable for production-like environments. The changes also include security hardening for the DynamoDB-compatible API by validating expression attribute names to prevent injection attacks. The cluster join logic in the demo has been made more robust. The test coverage is substantially increased with new unit, integration, and end-to-end tests, and a new multi-VM runbook provides clear deployment instructions. The overall quality of the changes is high.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bootjp bootjp enabled auto-merge March 3, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants